import qs from 'qs'    

export default $axios => ({
    getRoom(by, roomId) {
        return $axios.get('/server/account', {
            params: {
                type,
                username,
                password
            }
        })
    },
    getAccountList(type,username,password){
        return $axios.get('/server/account',{
            params:{
                type,
                username,
                password
            }
        })
    },
    resetAccount(type,username,password){
        return $axios.put('/server/account',qs.stringify({
            type,
            username,
            password      
        }))
    },
    updateAccount(type,username,email,firstName,lastName,status,address1,address2,city,state,zip,country,phone){
        return $axios.put('/server/account',qs.stringify({
            type,
            username,
            email,
            firstName,
            lastName,
            status,
            address1,
            address2,
            city,
            state,
            zip,
            country,
            phone     
        }))
    },
    deleteAccount(username){
        return $axios.delete('/server/account',{
            params:{
                username,
            }    
        })
    },
    addAccount({username,email,firstName,lastName,status,address1,address2,city,state,zip,country,phone}){
        return $axios.post('/server/account',qs.stringify({
                username,
                password:"123456",
                email,
                firstName,
                lastName,
                status,
                address1,
                address2,
                city,
                state,
                zip,
                country,
                phone
            })
        )
    }
})